package com.example.myapplication.chat;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.example.myapplication.R;
import com.example.myapplication.layout2;

/**
 * @ProjectName: My Application4
 * @Package: com.example.myapplication4
 * @ClassName: layout
 * @Description: java类作用描述
 * @Author:
 * @CreateDate: 2019/10/15 17:30
 * @UpdateUser: 更新者
 * @UpdateDate: 2019/10/15 17:30
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class layout extends AppCompatActivity {
    private Button next;
    private Button seelg;
    private TextView booklg;
    private EditText shuruT;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout);
        seelg=findViewById(R.id.seelg);
        next =(Button) findViewById(R.id.next);
        booklg=this.findViewById(R.id.booklg);
        shuruT=this.findViewById(R.id.shuruT);


        seelg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if ( !"".equals(shuruT.getText().toString())) {
                    booklg.setText(booklg.getText() + "" + shuruT.getText() + "未见异常、");
                    shuruT.setText("");
                }else if("".equals(shuruT.getText().toString())){
                    showDialog();
//                    Snackbar.make(v, "请输入内容！", Snackbar.LENGTH_LONG)
//                            .setAction("Action", null).show();
                }

            }
        });
        next.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent();//本页面--跳转页面
                i.setClass(layout.this, layout2.class);
//                //启动跳转
                startActivity(i);
            }
        });


    }
    private void showDialog(){
        AlertDialog.Builder builder=new AlertDialog.Builder(this);

        builder.setTitle("温馨提示");
        builder.setMessage("请输入内容！");
        builder.setPositiveButton("我知道了",
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {

                    }
                });
        AlertDialog dialog=builder.create();
        dialog.show();

    }



}
